import java.util.Scanner;
public class PontoFixo {
	
	public static double[] calc(Function func, double Pontoini, double Passo){
		
		
		if(func.CalcFun(5) < func.CalcFun(0)){
			Passo= 0-Passo;
		}
		
		double[] resp = new double[2];
		
		
		
		if(func.CalcFun(Pontoini)< 0){
			resp[0] = Pontoini;
			
			
			while(func.CalcFun(resp[0])*func.CalcFun(resp[0]+Passo)>0){
				
				resp[0]+=Passo;
			}
			
			resp[1] = resp[0]+Passo;
		}else if(func.CalcFun(Pontoini)==0){
			resp[0] = resp[1] = Pontoini;
		}else{
			resp[1] = Pontoini;
			
			while(func.CalcFun(resp[1])* func.CalcFun(resp[1]-Passo)>0){
				resp[1]-=Passo;
			}
			resp[0]= resp[1]-Passo;
		}
		
		return resp;
	}
	
	/*public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		Function func = new Function();
		double x, Passo;
		System.out.print("Digite o x inicial e o passo:");
		x = in.nextDouble();
		Passo = in.nextDouble();
		
		double[] resp = new double[2];
		
		resp = calc(func, x, Passo);
		
		System.out.println("Resp = "+resp[0]+" "+resp[1]);
	}*/
	
}
